<template>
	<view class="Tabs">
		<scroll-view scroll-x >
			<view class="scroll__tabs">
				<view v-for="(item,index) in list" :key="item.id" :class="['scroll__tabs__item',index==currentTab?'scroll__tabs__item__active':'']" @click="changeTab(index)">
					{{item.name}}
				</view>
			</view>
		</scroll-view>
		<view class="settings">
			<text class="iconfont icon-shezhi"></text>
		</view>
	</view>
</template>

<script>
	export default {
		name:"Tabs",
		props:{
			list:{
				type:Array,
				require:true,
				default:[]
			},
			currentTab:{
				type:Number,
				required:true,
				default:0
			}
		},
		data() {
			return {
				
			};
		},
		methods:{
			changeTab(e){
				// console.log(e);
				this.$emit("changeTab",e)
			}
		}
	}
</script>

<style lang="scss">
	.Tabs{
		width: 100%;
		border-bottom: 1px #f5f5f5 solid;
		display: flex;
		box-sizing: border-box;
		.scroll__tabs{
			display: flex;
			flex-wrap: nowrap;
			height: 90rpx;
			.scroll__tabs__item{
				flex-shrink: 0;
				padding: 0 20rpx;
				color: #333;
				display: flex;
				align-items: center;
				&__active{
					color: $base-Color;
				}
			}
		}
		.settings{
			position: relative;
			width: 90prx;
			display: flex;
			justify-content: center;
			align-items: center;
			padding: 0 20rpx;
			&::before {
				content:"";
				width:1px;
				position: absolute;
				top: 12px;
				bottom: 12px;
				left: 0;
				background-color: #eee;
			}
		}
	}

</style>
